<!DOCTYPE html>
{% load static %}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>动态详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- CSS
    ==================================================
    <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>-->
    <link rel="stylesheet" href="{% static 'app01/css/bootstrap.css' %}">
    <link rel="stylesheet" href="{% static 'app01/css/bootstrap-responsive.css' %}">
    <link rel="stylesheet" href="{% static 'app01/css/prettyPhoto.css' %}"/>
    <link rel="stylesheet" href="{% static 'app01/css/custom-styles.css' %}">

    <!--[if lt IE 9]
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> [endif]-->
    <link rel="stylesheet" href="{% static 'app01/css/style-ie.css' %}"/>


    <!-- Favicons
    ================================================== -->
    <link rel="shortcut icon" href="{% static 'app01/img/favicon.ico' %}">
    <link rel="apple-touch-icon" href="{% static 'app01/img/apple-touch-icon.png' %}">
    <link rel="apple-touch-icon" sizes="72x72" href="{% static 'app01/img/apple-touch-icon-72x72.png' %}">
    <link rel="apple-touch-icon" sizes="114x114" href="{% static 'app01/img/apple-touch-icon-114x114.png' %}">

    <!-- JS
    ==================================================
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>-->
    <script src="{% static 'app01/js/jquery.easing.1.3.js' %}"></script>
    <script src="{% static 'app01/js/bootstrap.js' %}"></script>
    <script src="{% static 'app01/js/jquery.prettyPhoto.js' %}"></script>
    <script src="{% static 'app01/js/jquery.quicksand.js' %}"></script>
    <script src="{% static 'app01/js/jquery.custom.js' %}"></script>

    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        ul {
            list-style: none;
        }

        #nav {
            height: 50px;
            background-color: #46474a;
        }

        #nav ul li {
            width: 120px;
            float: left;
        }

        #nav ul li a {
            display: block;
            width: 120px;
            height: 50px;
            line-height: 50px;
            text-decoration: none;
            font-size: 18px;
            /* font-weight: bold; */
            color: white;
            text-align: center;
        }

        #nav ul li a:hover {
            background-color: white;
            color: #46474a;
        }

        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 12px 16px;
            z-index: 1;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }
    </style>
    <style type="text/css">
        li.margin {
            margin-left: 50px;
        }
    </style>

</head>

<body>
<div class="color-bar-1"></div>
<div class="color-bar-2 color-bg"></div>

<div class="container">

    <!-- 导航栏 -->
    <div id="nav" style="margin: -15px;margin-left: -175px;margin-right: -175px;">
    <ul>
        <li class="margin"><img src="{% static 'app01/img/logo.png' %}" style="width: 87.4px;height: 50px;">
        </li>
        <li><a href="{% url 'purchase_index' %}">购物商城</a></li>
        <li><a href="/moment/">车友圈</a></li>
        <li><a href="/view_power/">充电规划</a></li>
        <li><a href="/chatbot/botmain/">智能客服</a></li>
        <li><a href="/repair/">维修保养</a></li>

        {% if "info" in request.session.keys %}

        <li class="dropdown">
            <a href="#">
                我的</a>
            <div class="dropdown-content">
                <a href="{% url 'show_order' %}" style="color: #46474a;font-size: 17px;">购物订单</a>
                <a href="/repair/list/" style="color: #46474a;font-size: 17px;">维修订单</a>
                <a href="/infomation/" style="color: #46474a;font-size: 17px;">个人信息</a>
                <a href="/signout/" style="color: #46474a;font-size: 17px;">注销</a>
            </div>
        </li>

        {% else %}
        <li><a href="/signin/">登录 / 注册</a></li>
        {% endif %}

    </ul>
    </div>
    <!-- 导航栏结束 -->

    <!-- 内容 -->
    <div class="row" style="width: 90%;margin: 0 auto;">
        <!-- 帖子信息 -->
        <div class="span12 gallery-single">
            <div class="row" style="margin-bottom: 0">
                <div class="span6">
                    <!-- 图片 -->
                    <img src="{{ t_photo }}" style="width: 100%; height:auto;" class="align-left thumbnail" alt="image">
                    <!-- 基本信息 -->
                    <ul style="font-size: 15px;" class="project-info">
                        <li><h6 style="font-size: 15px;">发布时间:</h6> {{ t_time }}</li>
                        <li><h6 style="font-size: 15px;">作者:</h6> {{ t_uname }}</li>
                    </ul>
                </div>
                <div class="span6">
                    <p style="margin-top: 100px; font-size: 20px;">动态内容：<br><br></p>
                    <p style="font-size: 17px; margin-left: 30px;">{{ t_content }}</p>
                </div>
            </div>
        </div>
    </div>

    <!-- 评论模块 -->
    <div class="row" style="width: 90%;margin: 0 auto;">
        <h2 style="text-shadow: none; font-size: 20px;">我要评论</h2>
        <form action="/detail/{{ tid }}/" method="post" enctype="multipart/form-data">
            {% csrf_token %}
            <div style="margin: 0 auto;">
                <textarea style="width: 95%;height: 200px;" cols="62" rows="20" name="r_content"></textarea>
            </div>
            图片：
            <input type="file" name="r_photo">
            <input type="submit" value="提交" style="float: right;">
        </form>
    </div>

    <!-- 评论区 -->
    <div class="row" style="width: 90%;margin: 0 auto;">
        <h2 style="text-shadow: none; font-size: 20px;">所有评论</h2>
        <div class="span12 gallery-single" style="margin-left: 0px;">
            <div class="row">
                <div class="span6" style="width: 100%;">
                    <ul class="project-info" style="margin-right: 200px;">
                        {% for r in reply_list %}
                        <li>
                            <h6 style="font-weight: 800; font-size: larger;">{{ r.r_uname }}:</h6> {{ r.r_content }}
                            <span style="float: right;">{{ r.r_time }}</span>&nbsp;
                            {# <a style="float: right;margin-right: 10px">回复</a>#}
                            <a iddd="{{ r.id }}" onclick="deleter(this);" style="float: right;margin-right: 10px">删除</a>
                            {% if r.r_photo %}
                            <img style="width: 50px;height: 50px;" src="{{ r.r_photo }}">
                            {% endif %}
                        </li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- 评论区结束 -->


</div>

<!-- 结尾部分 -->
<div class="footer-container">
    <div class="container">
        <div style="margin-top: 30px" class="row">
            <div class="span12 footer-col footer-sub">
                <div class="row no-margin">
                    <div class="span6"><span class="left">车友圈</span>
                    </div>
                    <div class="span6">
                            <span class="right">
                            <a href="#">主页</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="#">联系我们</a>
                            </span>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<!-- 尾部结束 -->

<!-- 回到顶端 -->
<div id="toTop" class="hidden-phone hidden-tablet">回到顶端</div>


<script>
    function deleter(ths) {
        var rid = $(ths).attr("iddd");
        $.ajax({
            url: window.location.href,
            type: "POST",
            data: {'type': 'delete', 'id': rid},
            beforeSend: function (xhr, settings) {
                xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");    // csrf
            },
            success: function (data) {
                // data是服务器端返回的字符串
                var dic = JSON.parse(data)
                if (!dic.status) alert(JSON.parse(data).msg);
                else window.location.href = window.location.href;
            }
        });
    }
</script>
</body>
</html>
